//
//  GMDataController.h
//  GradientColorNav
//
//  Created by steven on 2016/12/9.
//  Copyright © 2016年 steven. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>

typedef void(^GMCompletionCallback)(NSString *error);
typedef void(^GMSuccessCallback)(id object);
typedef void(^GMFailureCallback)(NSInteger statusCode, NSString *message);
typedef void(^GMFormDataCallback)(id <AFMultipartFormData> formData);

typedef NS_ENUM(NSUInteger, TYPE) {
    GET,
    POST,
    PUT,
    DELETE
};

@interface GMDataController : NSObject

@property (nonatomic, strong)AFHTTPSessionManager *manager;

- (void)setToken;

- (void)requestWithType:(TYPE)type url:(NSString *)url params:(NSDictionary *)params success:(GMSuccessCallback)success failure:(GMFailureCallback)failure;

- (void)postWithurl:(NSString *)url params:(NSDictionary *)params formData:(GMFormDataCallback)formData success:(GMSuccessCallback)success failure:(GMFailureCallback)failure;
@end
